<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
  --time-list: 30s 300s;
}
.target {
  --time-list: 10s 100s;
}
</style>
<body>
<script src="../interpolation/resources/interpolation-test.js"></script>
<script>
CSS.registerProperty({
  name: '--time-list',
  syntax: '<time>+',
  initialValue: '40s 400s',
  inherits: false,
});

assertInterpolation({
  property: '--time-list',
  from: 'initial',
  to: '20s 200s',
}, [
  {at: -0.3, is: '46s 460s'},
  {at: 0, is: '40s 400s'},
  {at: 0.5, is: '30s 300s'},
  {at: 1, is: '20s 200s'},
  {at: 1.5, is: '10s 100s'},
]);

assertInterpolation({
  property: '--time-list',
  from: 'inherit',
  to: '20s 200s',
}, [
  {at: -0.3, is: '33s 330s'},
  {at: 0, is: '30s 300s'},
  {at: 0.5, is: '25s 250s'},
  {at: 1, is: '20s 200s'},
  {at: 1.5, is: '15s 150s'},
]);

assertInterpolation({
  property: '--time-list',
  from: 'unset',
  to: '20s 200s',
}, [
  {at: -0.3, is: '46s 460s'},
  {at: 0, is: '40s 400s'},
  {at: 0.5, is: '30s 300s'},
  {at: 1, is: '20s 200s'},
  {at: 1.5, is: '10s 100s'},
]);

assertInterpolation({
  property: '--time-list',
  from: '-10s -100s',
  to: '10s 100s',
}, [
  {at: -0.3, is: '-16s -160s'},
  {at: 0, is: '-10s -100s'},
  {at: 0.5, is: '0s 0s'},
  {at: 1, is: '10s 100s'},
  {at: 1.5, is: '20s 200s'}
]); 

assertInterpolation({
  property: '--time-list',
  from: '10s',
  to: '100s',
}, [
  {at: -0.3, is: '-17s'},
  {at: 0, is: '10s'},
  {at: 0.5, is: '55s'},
  {at: 1, is: '100s'},
  {at: 1.5, is: '145s'}
]);

assertInterpolation({
  property: '--time-list',
  from: '0s 1000ms',
  to: '1000ms 0s',
}, [
  {at: -0.3, is: '-0.3s 1.3s'},
  {at: 0, is: '0s 1s'},
  {at: 0.5, is: '0.5s 0.5s'},
  {at: 1, is: '1s 0s'},
  {at: 1.5, is: '1.5s -0.5s'}
]);

assertInterpolation({
  property: '--time-list',
  from: neutralKeyframe,
  to: '20s 200s',
}, [
  {at: -0.3, is: '7s 70s'},
  {at: 0, is: '10s 100s'},
  {at: 0.5, is: '15s 150s'},
  {at: 1, is: '20s 200s'},
  {at: 1.5, is: '25s 250s'},
]);

assertComposition({
  property: '--time-list',
  underlying: '50s 60s',
  addFrom: '10s 140s',
  addTo: '110s 40s',
}, [
  {at: -0.3, is: '30s 230s'},
  {at: 0, is: '60s 200s'},
  {at: 0.5, is: '110s 150s'},
  {at: 1, is: '160s 100s'},
  {at: 1.5, is: '210s 50s'},
]);

assertComposition({
  property: '--time-list',
  underlying: '50s 60s',
  addFrom: '10s 140s',
  replaceTo: '110s 40s',
}, [
  {at: -0.3, is: '45s 248s'},
  {at: 0, is: '60s 200s'},
  {at: 0.5, is: '85s 120s'},
  {at: 1, is: '110s 40s'},
  {at: 1.5, is: '135s -40s'},
]);

</script>
</body>
